﻿using System;
using System.Collections.Generic;
using System.Text;
using log4net;
namespace ECC_EXT_HttpLib
{
    public class AccountInfo
    {


        public string idName { get; set; }
        public string idNo { get; set; }
        public string idAdd { get; set; }
        public string idTel { get; set; }
        public string idAdd2 { get; set; }
        public string idTel2 { get; set; }

        public string checkNo_Name { get; set; }
        public string checkNo_No { get; set; }
        public string checkNo_strCopy { get; set; }

        public string checkMail_Name { get; set; }
        public string checkMail_No { get; set; }
        public string checkMail_strCopy { get; set; }

        public string checkMail2_Name { get; set; }
        public string checkMail2_No { get; set; }
        public string checkMail2_strCopy { get; set; }

        public string DeviceTarget { get; set; }
        public string MPS { get; set; }
        public string HasSystem { get; set; }

        public bool isMatch
        {

            get
            {
                //ILog logger = LogManager.Exists("FindBug");
                bool res = false;

                if (idName == null 
                    || idNo == null
                    || checkNo_Name == null
                    || checkMail_Name == null
                    || checkNo_No == null
                    || checkMail_No == null)
                    return res;

                bool checkname = true;
                bool checkno = true;


                if (!checkNo_Name.Equals(checkMail_Name)
                    || !string.IsNullOrEmpty(idAdd2) && !checkNo_Name.Equals(checkMail2_Name))
                {
                    checkname = false;
                }

                if ( !checkNo_No.Equals(checkMail_No)
                    || !string.IsNullOrEmpty(idAdd2) && !checkNo_No.Equals(checkMail2_No))
                {
                    checkno = false;
                }
                //logger.Debug(checkname);
                //logger.Debug(checkno);

                //logger.Debug(idName);
                //logger.Debug(checkNo_Name);
                if (!(idName.Replace("　", "").Replace(" ", ""))
                        .Equals(checkNo_Name.Replace("　", "").Replace(" ", "")))
                {
                    checkname = false;
                }
                //logger.Debug(idNo);
                //logger.Debug(checkNo_No);
                if (!idNo.Equals(checkNo_No))
                {
                    checkno = false;
                }

                //logger.Debug(checkname);
                //logger.Debug(checkno);
                if (checkname && checkno)
                    res = true;

                return res;
            }
        }

        public string MatchRes
        {
            get
            {
                string res = "";

                if(idName == null || idNo == null)
                    return res;

                if (isMatch)             
                    res = "相違なし！";
                else
                    res = "相違有or不明";

                return res;
            }
        }



    }
}
